package mask;

import java.util.Scanner;

public class Title1 {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		System.out.println("输入出生年");
		int birthYear = scan.nextInt();
		System.out.println("输入出生月");
		int birthMonth = scan.nextInt();
		System.out.println("输入出生日");
		int birthDay =scan.nextInt();
		System.out.println("输入现在年");
		int year = scan.nextInt();
		System.out.println("输入现在月");
		int month = scan.nextInt();
		System.out.println("输入现在日");
		int day =scan.nextInt();
		if(birthDay<day) {
			if(birthMonth<month) {
				System.out.println(year-birthYear);
			}
			else
				System.out.println(year-birthYear-1);
		}
		else {
			if(birthMonth<month) {
				System.out.println(year-birthYear);
			}
			else
				System.out.println(year-birthYear-1);
		}
		}
	} 
